import Vue from 'vue';
import Vuex from 'vuex';
import request from "@/common/request";

Vue.use(Vuex);

export default {
  namespaced: true,
  state: {
    remarkCount: 0 // 初始消息数量
  },
  mutations: {
    decrementRemarkCount(state) {
      state.remarkCount -= 1;
    }
  },
  actions: {
    markRemarkAsRead({ commit }) {
      commit('decrementRemarkCount');
    },
    async getUnreadRemarkNum({ commit, state }) {
      const res = await request({
        url: '/apiwork/monad/getUnreadRemarkNum',
        method: 'post',
      })
      state.remarkCount = res.data
    },
  }
}
